//
//  HomeBannerTableViewCell.m
//  community
//
//  Created by 小崔 on 2020/5/29.
//  Copyright © 2020 小崔. All rights reserved.
//

#import "HomeBannerTableViewCell.h"


@implementation HomeBannerTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self ScrollNetWorkImages];
    }
    return self;
}


-(void)ScrollNetWorkImages{
    
    /** 测试本地图片数据*/
//    CGRect rect = CGRectMake(0, 0, SCREENWIDTH, 200);
    self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:[UIImage imageNamed:@"PlacehoderImage.png"]];
   
    
    //设置图片视图显示类型
    self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleToFill;
    
    //设置轮播视图的分页控件的显示
    self.cycleScrollView.showPageControl = YES;
    
    //设置轮播视图分也控件的位置
    self.cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
    
    //当前分页控件小圆标图片
    self.cycleScrollView.pageDotImage = [UIImage imageNamed:@"pageCon.png"];

    //其他分页控件小圆标图片
    self.cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"pageConSel.png"];
    
    [self addSubview:self.cycleScrollView];
    
    WEAKSELF
    [self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.mas_top).offset(iPhoneXStyle ? -44 : -20);
        make.left.equalTo(weakSelf.mas_left);
        make.right.equalTo(weakSelf.mas_right);
        make.height.equalTo(@200);
    }];

}
#pragma mark - 代理方法
/** 点击图片回调 */
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    
    //NSLog(@"%ld",index);
}

/** 图片滚动回调 */
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index{
    
   //NSLog(@"%ld",index);
}


///**
// *  懒加载网络图片数据
// */
//-(NSMutableArray *)netImages{
//    if (!_netImages) {
//        _netImages = [[NSMutableArray alloc]init];
//    }
//    return _netImages;
//}

@end
